<tagLib name="html" />
{$header}<div id="main" class="main" >
<!-- 主体内容  -->
<div class="content" >
  
<!--  功能组区域  -->
<div class="btn-toolbar">
      <div class="btn-group">
  <button class="btn btn-primary" onclick="add1()"><i class="icon-plus icon-white"></i> 新增</button>
<button class="btn btn-primary" onclick="edit1()"><i class="icon-edit icon-white"></i> 编辑</button>
<button class="btn btn-primary" onclick="checkunique()"><i class="icon-trash icon-white"></i>重复记录</button>
<button class="btn btn-primary" onclick="importProduct()"><i class="icon-upload icon-white"></i> 导入库存</button>
<button class="btn btn-primary" onclick="foreverdel()"><i class="icon-trash icon-white"></i> 删除</button>
</div>
<!-- 查询区域 -->
<form class="search-form pull-right" method='get' action="__URL__">
  {:modList('Category',$_REQUEST['cat_id'],'span2','cat_id')}
		<input type="text" class="search-query span4" name="keywords" <notempty name='_REQUEST.keywords'>
		<php>echo 'value="'.urldecode($_REQUEST['keywords']).'"'</php>
		<else/>
		placeholder="产品中文，英文，CAS"
	</notempty>
	>
	<input type="submit" class="btn btn-primary" value="搜索"></form>
</div>
<!-- 功能组区域结束 -->
<php>
    function getMinstock($pid){
        return getModelName($pid,'Product','minstock');
    }
</php>
<!-- 列表显示区域  -->
<div class="list" >
<div id="result" class="result none"></div><html:list id="checkList" style="table table-bordered table-striped" name="action" checkbox="true" action="true" datasource="list" pk="sid" show="sid:编号|5%:edit1,name:产品,specification:规格,cas:CAS,number:库存(KG),minstock:库存报警点" actionlist="edit1:编辑:sid,detail:库存历史:sid" />
</div>
<!--  分页显示区域 -->
<div class="page">{$page}</div>
<!-- 列表显示区域结束 -->
</div>
<!-- 主体内容结束 -->
</div>
<!-- 主页面结束 -->
<include file="Public:footer"/>
<script type="text/javascript">
function checkunique(){
     location.href  = URL+"/unique";
}

  function importProduct(){
    location.href = APP+"/Stock/import";
}
function add1(id){
  if (id)
  {
     location.href  = URL+"/add1/id/"+id;
  }else{
     location.href  = URL+"/add1/";
  }
}
function detail(id){
  if (id)
  {
     location.href  = URL+"/detail/id/"+id;
  }else{
     alert('请选择库存记录');
  }
}
function edit1(id){
  var keyValue;
  if (id)
  {
    keyValue = id;
  }else {
    keyValue = getSelectCheckboxValue();
  }
  if (!keyValue)
  {
    alert('请选择编辑项！');
    return false;
  }
  location.href =  URL+"/edit1/id/"+keyValue;
}
</script>

